//
//  YDMineControllerCell.m
//  PeiZiWangBei
//
//  Created by LK-IOS on 2017/11/9.
//  Copyright © 2017年 LK-IOS. All rights reserved.
//

#import "YDMineControllerCell.h"

@interface YDMineControllerCell()
//分割线
@property (nonatomic , weak) UIView *lineView;
//acc
@property (nonatomic , weak) UIImageView *accImage;
//类型图片
@property (nonatomic , weak) UIImageView *cateImage;
//类型
@property (nonatomic , weak) UILabel *cateLabel;
@end

@implementation YDMineControllerCell

-(void)setImageName:(NSString *)imageName
{
    _imageName = imageName;
    self.cateImage.image = [UIImage imageNamed:imageName];
}
-(void)setCellName:(NSString *)cellName
{
    _cellName = cellName;
    self.cateLabel.text = cellName;
    
}
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *mineControllerCell = @"YDMineControllerCell";
    YDMineControllerCell *cell = [tableView dequeueReusableCellWithIdentifier:mineControllerCell];
    if (cell == nil) {
        cell = [[YDMineControllerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:mineControllerCell];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.backgroundColor = [UIColor whiteColor];
        [self lineView];
        [self accImage];
        [self cateImage];
        [self cateLabel];
    }
    return self;
}



-(UIView *)lineView
{
    if (_lineView == nil) {
        UIView *lineView = [[UIView alloc] init];
        [self.contentView addSubview:lineView];
        lineView.backgroundColor = NumberColor(247, 247, 247);
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self);
            make.height.equalTo(@1);
            make.left.equalTo(self).offset(20);
            make.right.equalTo(self).offset(-20);
        }];
        _lineView = lineView;
    }
    return _lineView;
}
-(UIImageView *)accImage
{
    if (_accImage == nil) {
        UIImageView *accImage = [[UIImageView alloc] init];
        [self.contentView addSubview:accImage];
        accImage.image = [UIImage imageNamed:@"wode-gd-grey"];
        [accImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.right.equalTo(self).offset(-rate375(20));
        }];
        _accImage = accImage;
    }
    return _accImage;
}
-(UIImageView *)cateImage
{
    if (_cateImage == nil) {
        UIImageView *cateImage = [[UIImageView alloc] init];
        [self.contentView addSubview:cateImage];
        cateImage.image = [UIImage imageNamed:@"wd-wdcc"];
        [cateImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.left.equalTo(self).offset(rate375(20));
        }];
        _cateImage = cateImage;
    }
    return _cateImage;
}
-(UILabel *)cateLabel
{
    if (_cateLabel == nil) {
        UILabel *cateLabel = [[UILabel alloc] init];
        [self.contentView addSubview:cateLabel];
        cateLabel.textColor = [UIColor colorWithHexString:@"687284"];
        cateLabel.font = [UIFont systemFontOfSize:font16ScreenWRate * LKScreenW];
        cateLabel.textAlignment = NSTextAlignmentLeft;
        cateLabel.text = @"---";
        [cateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.cateImage.mas_right).offset(rate375(7));
            make.centerY.equalTo(self);
        }];
        _cateLabel = cateLabel;
    }
    return _cateLabel;
}
@end
